using System;
namespace CommandLib.Base
{
	public class MathHelper
	{
		public static string GetPer(int dec, int pdec, int len)
		{
			return MathHelper.GetPer(Convert.ToDecimal(dec), Convert.ToDecimal(pdec), len);
		}
		public static string GetPer(decimal dec, decimal pdec, int len)
		{
			string result;
			if (pdec > 0m)
			{
				result = (dec * 100m / pdec).ToString("F" + len) + "%";
			}
			else
			{
				result = "0%";
			}
			return result;
		}
	}
}
